﻿using QxFramework.Core;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class SlimeAttack_AnmEv : BulletBase
{
    public SkillBase Skill;
    public override void Init(SkillBase skill, Vector2 pos)
    {
        Skill = skill;
        transform.position = pos;
        attackInfo = new AttackInfo();
    }
    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.gameObject.tag == "Player")
        {
            hitList.Add(collision.gameObject.GetComponent<EntityBase>());
            attackInfo.targets = hitList;
            Debug.Log("hit");
            //MessageManager.Instance.Get<SlimeAttack_Event>().DispatchMessage(SlimeAttack_Event.Damage, this, attackInfo);
            Skill.Damage(attackInfo);
            hitList.Clear();
        }

    }
    public void Stop()
    {
        
        //Debug.Log("StopSlime");
        EffectManager.Instance.RecycleEffect(this.gameObject);
    }
}
